home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / easyx / data1.cab / Example_Files / pong / Form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-11-03  |  19.4 KB  |  544 lines

  1. VERSION 5.00
  2. Object = "{5A65A9C0-089F-11D2-88AD-0000B45C4CF6}#1.0#0"; "EASYX.OCX"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Pong"
  5.    ClientHeight    =   3195
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   4680
  9.    Icon            =   "Form1.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3195
  12.    ScaleWidth      =   4680
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.Timer SetUpTimer 
  15.       Enabled         =   0   'False
  16.       Interval        =   1000
  17.       Left            =   1800
  18.       Top             =   1320
  19.    End
  20.    Begin PROJECTEXLibCtl.EasyX EasyX 
  21.       Left            =   960
  22.       OleObjectBlob   =   "Form1.frx":014A
  23.       Top             =   120
  24.    End
  25. Attribute VB_Name = "Form1"
  26. Attribute VB_GlobalNameSpace = False
  27. Attribute VB_Creatable = False
  28. Attribute VB_PredeclaredId = True
  29. Attribute VB_Exposed = False
  30. Option Explicit
  31. 'Characters
  32. Dim FontSurface As Long
  33. Dim Character(35) As Long
  34. Const CharacterWidth As Long = 16
  35. Const CharacterHeight As Long = 16
  36. Const YTop As Long = 384 - 50
  37. Const LevelX As Long = 10
  38. Const PointX As Long = 10 + 12 * 16
  39. Const BallsX As Long = 10 + 9 * 16 + 15 * 16
  40. Dim CountDown As Long
  41. Dim CurrentLevel As Long
  42. Dim TotalPoint As Long
  43. Dim CurrentBoulderHit As Long
  44. Dim BallsLeft As Long
  45. 'sounds
  46. Dim SoundWallHit As Long
  47. Dim SoundBoulderHit As Long
  48. Dim SoundPlateHit As Long
  49. 'ball
  50. Dim BallSurface As Long
  51. Dim Ball As Sprite
  52. Const BallWidth As Long = 7
  53. Const BallHeight As Long = 7
  54. Dim BallMovePrLoop As Long
  55. Dim BallEnglish As Long
  56. 'boulders
  57. Dim BoulderSurface As Long
  58. Dim Boulders(29) As Boulder
  59. Const BoulderHeight As Long = 15
  60. Const BoulderWidth As Long = 40
  61. Dim BoulderSpace As Long
  62. Dim YBoulderPosition As Long
  63. 'Screen coordinate
  64. Const ScreenWidth As Long = 512
  65. Const ScreenHeight As Long = 384
  66. 'keys
  67. Dim KeyDirection As Long
  68. Dim PreviousKey As Long
  69. 'plate variables
  70. Dim PlateSurface As Long
  71. Dim Plate(1) As Long
  72. Dim PlateX As Long
  73. Dim PlateY As Long
  74. Const PlateWidth As Long = 50
  75. Const PlateHeight As Long = 10
  76. Const PlateMove As Long = 5
  77. Private Sub SetSounds()
  78. Dim AppPath As String
  79. AppPath = App.Path & "\sounds\"
  80. EasyX.InitializeSound
  81. SoundWallHit = EasyX.CreateStaticSound(AppPath & "wallhit.wav")
  82. SoundBoulderHit = EasyX.CreateStaticSound(AppPath & "boulderhit.wav")
  83. SoundPlateHit = EasyX.CreateStaticSound(AppPath & "platehit.wav")
  84. End Sub
  85. Private Function BoulderHit(BoulderIndex As Long) As Boolean
  86. Dim BallCenterX As Long, BallCenterY As Long
  87. Dim BoulderCenterX As Long, BoulderCenterY As Long
  88. If Boulders(BoulderIndex).Hit = True Then
  89.     BoulderHit = False
  90.     Exit Function
  91. End If
  92. BallCenterX = Ball.XPoint + (BallWidth \ 2)
  93. BallCenterY = Ball.YPoint + (BallHeight \ 2)
  94. BoulderCenterX = Boulders(BoulderIndex).XPoint + (BoulderWidth \ 2)
  95. BoulderCenterY = Boulders(BoulderIndex).YPoint + (BoulderHeight \ 2)
  96. BoulderHit = False
  97. If Abs(BallCenterY - BoulderCenterY) < ((BallHeight + BoulderHeight) \ 2) Then
  98.     If Abs(BallCenterX - BoulderCenterX) < ((BallWidth + BoulderWidth) \ 2) Then
  99.         BoulderHit = True
  100.     End If
  101. End If
  102. End Function
  103. Private Sub CheckBoulderHit()
  104. Dim I As Long
  105. If Ball.YPoint > Boulders(UBound(Boulders)).YPoint + BoulderHeight Then
  106.     Exit Sub
  107. End If
  108. For I = 0 To UBound(Boulders)
  109.     If BoulderHit(I) = True And Not Boulders(I).Hit Then
  110.         Boulders(I).Hit = True
  111.         TotalPoint = TotalPoint + Boulders(I).Point
  112.         EasyX.StopStaticSound SoundBoulderHit
  113.         EasyX.PlayStaticSound SoundBoulderHit, 0
  114.         Ball.YDirection = Ball.YDirection * -1
  115.         CurrentBoulderHit = CurrentBoulderHit + 1
  116.     End If
  117. Next I
  118. End Sub
  119. Private Function CheckPlateHit() As Boolean
  120. If Ball.YPoint + BallHeight < PlateY Then Exit Function
  121. Dim BallCenterX As Long, BallCenterY As Long
  122. Dim PlateCenterX As Long, PlateCenterY As Long
  123. BallCenterX = Ball.XPoint + (BallWidth \ 2)
  124. BallCenterY = Ball.YPoint + (BallHeight \ 2)
  125. PlateCenterX = PlateX + (PlateWidth \ 2)
  126. PlateCenterY = PlateY + (PlateHeight \ 2)
  127. CheckPlateHit = False
  128. If Abs(BallCenterY - PlateCenterY) < ((BallHeight + PlateHeight) \ 2) Then
  129.     If Abs(BallCenterX - PlateCenterX) < ((BallWidth + PlateWidth) \ 2) Then
  130.         EasyX.PlayStaticSound SoundPlateHit, 0
  131.         CheckPlateHit = True
  132.     End If
  133. End If
  134. End Function
  135. Private Sub DrawBall()
  136. 'move it
  137. Ball.XPoint = Ball.XPoint + BallMovePrLoop * Ball.XDirection
  138. Ball.YPoint = Ball.YPoint + Ball.XSpeed * Ball.YDirection
  139. 'check wall hits
  140. If Ball.XPoint + BallWidth > ScreenWidth Then
  141.     Ball.XPoint = ScreenWidth - BallWidth
  142.     EasyX.SetStaticPan SoundWallHit, EX_SOUNDRIGHT
  143.     EasyX.PlayStaticSound SoundWallHit, 0
  144.     Ball.XDirection = Ball.XDirection * -1
  145. ElseIf Ball.XPoint < 0 Then
  146.     Ball.XPoint = 0
  147.     EasyX.SetStaticPan SoundWallHit, EX_SOUNDLEFT
  148.     EasyX.PlayStaticSound SoundWallHit, 0
  149.     Ball.XDirection = Ball.XDirection * -1
  150. End If
  151. If Ball.YPoint + BallHeight > ScreenHeight Then
  152.     Ball.YPoint = ScreenHeight - BallHeight
  153.     Ball.YDirection = Ball.YDirection * -1
  154. ElseIf Ball.YPoint < 0 Then
  155.     Ball.YPoint = 0
  156.     EasyX.SetStaticPan SoundWallHit, EX_MIDDLE
  157.     EasyX.PlayStaticSound SoundWallHit, 0
  158.     Ball.YDirection = Ball.YDirection * -1
  159. End If
  160. EasyX.DrawSprite Ball.XPoint, Ball.YPoint, BallWidth, BallHeight, Ball.Number
  161. End Sub
  162. Private Sub DrawBoulders()
  163. Dim I As Integer
  164. For I = 0 To UBound(Boulders)
  165.     If (Not Boulders(I).Hit) Then 'draw it
  166.         EasyX.DrawSprite Boulders(I).XPoint, Boulders(I).YPoint, BoulderWidth, BoulderHeight, Boulders(I).Number
  167.     End If
  168. Next I
  169. End Sub
  170. Private Sub DrawPlate(PlateHit As Long)
  171. Dim KeyLeft As Long, KeyRight As Long
  172. 'get the keys
  173. KeyLeft = EasyX.GetKeyState(EX_LEFT)
  174. If KeyLeft = EX_KEYBOARDLOST Then
  175.     EasyX.AcquireKeyboard
  176. End If
  177. KeyRight = EasyX.GetKeyState(EX_RIGHT)
  178. 'move the plate
  179. If KeyRight = EX_KEYDOWN And KeyLeft = EX_KEYDOWN Then 'both keys = no movement
  180.     KeyDirection = 0
  181. ElseIf KeyRight = EX_KEYDOWN Then
  182.     KeyDirection = 1
  183.     If BallEnglish < 0 Then BallEnglish = 0
  184.     BallEnglish = BallEnglish + 1
  185. ElseIf KeyLeft = EX_KEYDOWN Then
  186.     KeyDirection = -1
  187.     If BallEnglish > 0 Then BallEnglish = 0
  188.     BallEnglish = BallEnglish - 1
  189.     KeyDirection = 0
  190. End If
  191. PlateX = PlateX + PlateMove * KeyDirection
  192. If PlateX < 0 Then PlateX = 0
  193. If PlateX + PlateWidth > ScreenWidth Then PlateX = ScreenWidth - PlateWidth
  194. EasyX.DrawSprite PlateX, PlateY, PlateWidth, PlateHeight, Plate(PlateHit)
  195. End Sub
  196. Private Sub Form_Load()
  197. Dim rt As Long
  198. Dim I As Long, J As Long
  199. Dim AppPath As String
  200. t forget this
  201. EasyX.Window = Me.hWnd
  202. '''''''''''''''''''''
  203. AppPath = App.Path & "\images\"
  204. rt = EasyX.InitDirectDraw(ScreenWidth, ScreenHeight, 8)
  205. If rt <> EX_OK Then
  206.     EasyX.EndDirectX
  207.     MsgBox "Could not initialize direct draw", vbOKOnly, "Failure"
  208.     Unload Me
  209.     Exit Sub
  210. End If
  211. 'create the keyboard
  212. rt = EasyX.InitDirectInput()
  213. If rt <> EX_OK Then
  214.     EasyX.EndDirectX
  215.     MsgBox "Could not create keyboard", vbOKOnly, "Failure"
  216.     Unload Me
  217.     Exit Sub
  218. End If
  219. 'create the keyboard and mouse
  220. EasyX.CreateKeyboard
  221. EasyX.CreateMouse
  222. 'acquire the keyboard and mouse
  223. EasyX.AcquireKeyboard
  224. EasyX.AcquireMouse
  225. 'load the graphics
  226. PlateSurface = EasyX.LoadBitmapFile(AppPath & "plate.bmp", -1)
  227. If PlateSurface < 0 Then
  228.     EasyX.EndDirectX
  229.     MsgBox "Could not load graphic", vbOKOnly, "Failure"
  230.     Unload Me
  231.     Exit Sub
  232. End If
  233. BoulderSurface = EasyX.LoadBitmapFile(AppPath & "boulders.bmp", RGB(255, 255, 255))
  234. If BoulderSurface < 0 Then
  235.     EasyX.EndDirectX
  236.     MsgBox "Could not load graphic", vbOKOnly, "Failure"
  237.     Unload Me
  238.     Exit Sub
  239. End If
  240. BallSurface = EasyX.LoadBitmapFile(AppPath & "ball.bmp", 0)
  241. If BallSurface < 0 Then
  242.     EasyX.EndDirectX
  243.     MsgBox "Could not load graphic", vbOKOnly, "Failure"
  244.     Unload Me
  245.     Exit Sub
  246. End If
  247. FontSurface = EasyX.LoadBitmapFile(AppPath & "redfont.bmp", 0)
  248. If FontSurface < 0 Then
  249.     EasyX.EndDirectX
  250.     MsgBox "Could not load graphic", vbOKOnly, "Failure"
  251.     Unload Me
  252.     Exit Sub
  253. End If
  254. ''''''''''''''''
  255. 'make the plate
  256. Plate(0) = EasyX.MakeSprite(0, 0, 50, 10, PlateSurface)
  257. Plate(1) = EasyX.MakeSprite(0, 10, 50, 20, PlateSurface)
  258. PlateX = ScreenWidth / 2 - PlateWidth / 2
  259. PlateY = ScreenHeight - PlateHeight - 50
  260. 'make the boulders
  261. '6 blue boulders
  262. For I = 0 To 9
  263.     Boulders(I).Number = EasyX.MakeSprite(0, 0, 40, 15, BoulderSurface)
  264.     Boulders(I).Point = 2
  265. Next I
  266. '10 reds
  267. For I = 10 To 19
  268.     Boulders(I).Number = EasyX.MakeSprite(0, 15, 40, 30, BoulderSurface)
  269.     Boulders(I).Point = 1
  270. Next I
  271. '2 of the rest
  272. Boulders(20).Number = EasyX.MakeSprite(40, 0, 80, 15, BoulderSurface)
  273. Boulders(20).Point = 3
  274. Boulders(21).Number = EasyX.MakeSprite(40, 0, 80, 15, BoulderSurface)
  275. Boulders(21).Point = 4
  276. Boulders(22).Number = EasyX.MakeSprite(40, 15, 80, 30, BoulderSurface)
  277. Boulders(22).Point = 5
  278. Boulders(23).Number = EasyX.MakeSprite(40, 15, 80, 30, BoulderSurface)
  279. Boulders(23).Point = 6
  280. Boulders(24).Number = EasyX.MakeSprite(80, 0, 120, 15, BoulderSurface)
  281. Boulders(24).Point = 7
  282. Boulders(25).Number = EasyX.MakeSprite(80, 0, 120, 15, BoulderSurface)
  283. Boulders(25).Point = 5
  284. Boulders(26).Number = EasyX.MakeSprite(80, 15, 120, 30, BoulderSurface)
  285. Boulders(26).Point = 8
  286. Boulders(27).Number = EasyX.MakeSprite(80, 15, 120, 30, BoulderSurface)
  287. Boulders(27).Point = 5
  288. Boulders(28).Number = EasyX.MakeSprite(80, 15, 120, 30, BoulderSurface)
  289. Boulders(28).Point = 3
  290. Boulders(29).Number = EasyX.MakeSprite(80, 15, 120, 30, BoulderSurface)
  291. Boulders(29).Point = 10
  292. 'Set the boulder positions
  293. 'the space between the boulders
  294. CurrentLevel = 1
  295. TotalPoint = 0
  296. BallsLeft = 2
  297. CurrentBoulderHit = 0
  298. SetBoulders_Ball
  299. 'and the ball
  300. Ball.Number = EasyX.MakeSprite(0, 0, BallWidth, BallHeight, BallSurface)
  301. 'set the characters
  302. SetCharacters
  303. 'set text description
  304. EasyX.SetText EX_PRIMARYSURFACE, 0, RGB(0, 255, 0), 16, "Verdana"
  305. 'set the sound
  306. SetSounds
  307. 'Start the action
  308. CountDown = 3
  309. SetUpTimer.Enabled = True
  310. End Sub
  311. Private Sub SetBoulders_Ball()
  312. Dim J As Long, I As Long
  313. BoulderSpace = 10
  314. YBoulderPosition = 10
  315. For J = 1 To 3
  316.     For I = 1 To 10
  317.         Boulders(((J - 1) * 10) + I - 1).XPoint = BoulderSpace + ((I - 1) * (BoulderWidth + BoulderSpace))
  318.         Boulders(((J - 1) * 10) + I - 1).YPoint = YBoulderPosition
  319.         Boulders(((J - 1) * 10) + I - 1).Hit = False
  320.     Next I
  321.     'update y position
  322.     YBoulderPosition = YBoulderPosition + BoulderHeight + BoulderSpace
  323. Next J
  324. 'set the ball
  325. s starting positions
  326. Ball.XPoint = ScreenWidth / 2 - BallWidth / 2
  327. Ball.YPoint = ScreenHeight / 2 - BallHeight * 2
  328. 'set the direction
  329. Ball.XDirection = 1
  330. Ball.YDirection = -1
  331. 'set the ball
  332. s speed
  333. BallMovePrLoop = 1 + CurrentLevel
  334. Ball.XSpeed = 1 + CurrentLevel
  335. End Sub
  336. Private Sub RunMain()
  337.     If EasyX.GetKeyState(EX_ESCAPE) = EX_KEYDOWN Then
  338.         EasyX.EndDirectX
  339.         Unload Me
  340.         Exit Do
  341.     End If
  342.     'fill background with black
  343.     EasyX.FillSurface 0, EX_PRIMARYSURFACE
  344.     'draw the ball
  345.     DrawBall
  346.     'check boulder hits
  347.     CheckBoulderHit
  348.     If CurrentBoulderHit = 30 Then 'all hit
  349.         EasyX.FillSurface 0, EX_PRIMARYSURFACE
  350.         EasyX.FlipSurface
  351.         RunNextLevel
  352.         Exit Do
  353.     End If
  354.     'check plate hit
  355.     If CheckPlateHit() Then
  356.         DrawPlate 1
  357.         
  358.         If Abs(BallEnglish) > 0 Then
  359.             If BallEnglish > 0 Then
  360.                 If Ball.XDirection > 0 Then
  361.                     Ball.XSpeed = Ball.XSpeed + 1
  362.                 Else
  363.                     Ball.XSpeed = Ball.XSpeed - 1
  364.                     Ball.XDirection = Ball.XDirection * -1
  365.                 End If
  366.                 
  367.             ElseIf BallEnglish < 0 Then
  368.                 If Ball.XDirection < 0 Then
  369.                     Ball.XSpeed = Ball.XSpeed + 1
  370.                 Else
  371.                     Ball.XSpeed = Ball.XSpeed - 1
  372.                     Ball.XDirection = Ball.XDirection * -1
  373.                 End If
  374.             End If
  375.             
  376.             If Ball.XSpeed < 1 Then Ball.XSpeed = 1
  377.         End If
  378.         
  379.         Ball.YDirection = Ball.YDirection * -1
  380.     Else
  381.         DrawPlate 0
  382.         
  383.         If CheckPlateMiss() Then
  384.             BallsLeft = BallsLeft - 1
  385.                 If BallsLeft < 0 Then 'finish
  386.                     Runfinish
  387.                     Exit Do
  388.                 End If
  389.             EasyX.FillSurface 0, EX_PRIMARYSURFACE
  390.             EasyX.FlipSurface
  391.             RunReady
  392.             Exit Do
  393.         End If
  394.         
  395.     End If
  396.     DrawBoulders
  397.     'draw the text
  398.     DrawText
  399.     EasyX.FlipSurface
  400. End Sub
  401. Private Sub RunNextLevel()
  402. CurrentLevel = CurrentLevel + 1
  403. BallsLeft = BallsLeft + 1
  404. SetBoulders_Ball
  405. Ball.YDirection = -1
  406. CountDown = 3
  407. CurrentBoulderHit = 0
  408. SetUpTimer.Enabled = True
  409. End Sub
  410. Private Function CheckPlateMiss() As Boolean
  411. If Ball.YPoint - BallHeight / 2 > PlateY Then
  412.     CheckPlateMiss = True
  413.     CheckPlateMiss = False
  414. End If
  415. End Function
  416. Private Sub Runfinish()
  417. Const StartX As Long = 50
  418. Const StartY As Long = 50
  419. EasyX.FillSurface 0, EX_PRIMARYSURFACE
  420. EasyX.DrawSprite StartX, StartY, CharacterWidth, CharacterHeight, Character(T)
  421. EasyX.DrawSprite StartX + CharacterWidth * 1, StartY, CharacterWidth, CharacterHeight, Character(O)
  422. EasyX.DrawSprite StartX + CharacterWidth * 2, StartY, CharacterWidth, CharacterHeight, Character(T)
  423. EasyX.DrawSprite StartX + CharacterWidth * 3, StartY, CharacterWidth, CharacterHeight, Character(A)
  424. EasyX.DrawSprite StartX + CharacterWidth * 4, StartY, CharacterWidth, CharacterHeight, Character(L)
  425. EasyX.DrawSprite StartX + CharacterWidth * 6, StartY, CharacterWidth, CharacterHeight, Character(P)
  426. EasyX.DrawSprite StartX + CharacterWidth * 7, StartY, CharacterWidth, CharacterHeight, Character(O)
  427. EasyX.DrawSprite StartX + CharacterWidth * 8, StartY, CharacterWidth, CharacterHeight, Character(I)
  428. EasyX.DrawSprite StartX + CharacterWidth * 9, StartY, CharacterWidth, CharacterHeight, Character(N)
  429. EasyX.DrawSprite StartX + CharacterWidth * 10, StartY, CharacterWidth, CharacterHeight, Character(T)
  430. EasyX.DrawSprite StartX + CharacterWidth * 11, StartY, CharacterWidth, CharacterHeight, Character(S)
  431. DrawNumber TotalPoint, StartX + CharacterWidth * 13, StartY
  432. EasyX.DrawSprite StartX, StartY * 2, CharacterWidth, CharacterHeight, Character(P)
  433. EasyX.DrawSprite StartX + CharacterWidth * 1, StartY * 2, CharacterWidth, CharacterHeight, Character(L)
  434. EasyX.DrawSprite StartX + CharacterWidth * 2, StartY * 2, CharacterWidth, CharacterHeight, Character(A)
  435. EasyX.DrawSprite StartX + CharacterWidth * 3, StartY * 2, CharacterWidth, CharacterHeight, Character(Y)
  436. EasyX.DrawSprite StartX + CharacterWidth * 5, StartY * 2, CharacterWidth, CharacterHeight, Character(A)
  437. EasyX.DrawSprite StartX + CharacterWidth * 6, StartY * 2, CharacterWidth, CharacterHeight, Character(G)
  438. EasyX.DrawSprite StartX + CharacterWidth * 7, StartY * 2, CharacterWidth, CharacterHeight, Character(A)
  439. EasyX.DrawSprite StartX + CharacterWidth * 8, StartY * 2, CharacterWidth, CharacterHeight, Character(I)
  440. EasyX.DrawSprite StartX + CharacterWidth * 9, StartY * 2, CharacterWidth, CharacterHeight, Character(N)
  441. EasyX.FlipSurface
  442.     If EasyX.GetKeyState(EX_Y) = EX_KEYDOWN Then
  443.         SetStart
  444.         Exit Do
  445.     ElseIf EasyX.GetKeyState(EX_N) = EX_KEYDOWN Then
  446.         EasyX.EndDirectX
  447.         Unload Me
  448.         Exit Do
  449.     End If
  450. End Sub
  451. Private Sub SetStart()
  452. CurrentLevel = 1
  453. BallsLeft = 3
  454. TotalPoint = 0
  455. SetBoulders_Ball
  456. Ball.YDirection = -1
  457. CountDown = 3
  458. CurrentBoulderHit = 0
  459. SetUpTimer.Enabled = True
  460. End Sub
  461. Private Sub SetUpTimer_Timer()
  462. EasyX.FillSurface 0, EX_PRIMARYSURFACE
  463. EasyX.PrintText EX_PRIMARYSURFACE, "Get ready: " & Str(CountDown), (ScreenWidth / 2 - (Len("Get ready:  ") * 5)), ScreenHeight / 2 - 8, 100, 20
  464. EasyX.FlipSurface
  465. If CountDown = 0 Then
  466.     SetUpTimer.Enabled = False
  467.     CountDown = 3
  468.     RunMain
  469. End If
  470. CountDown = CountDown - 1
  471. End Sub
  472. Private Sub SetCharacters()
  473. Dim I As Long, J As Long
  474. For J = 1 To 2
  475.     For I = 1 To 18
  476.         Character(((J - 1) * 18) + I - 1) = EasyX.MakeSprite((I - 1) * 16, (J - 1) * 16, _
  477.                                                             I * 16, J * 16, FontSurface)
  478.     Next I
  479. Next J
  480. End Sub
  481. Private Sub DrawText()
  482. EasyX.DrawSprite LevelX, YTop, CharacterWidth, CharacterHeight, Character(L)
  483. EasyX.DrawSprite LevelX + 16, YTop, CharacterWidth, CharacterHeight, Character(E)
  484. EasyX.DrawSprite LevelX + 32, YTop, CharacterWidth, CharacterHeight, Character(V)
  485. EasyX.DrawSprite LevelX + 48, YTop, CharacterWidth, CharacterHeight, Character(E)
  486. EasyX.DrawSprite LevelX + 64, YTop, CharacterWidth, CharacterHeight, Character(L)
  487. DrawNumber CurrentLevel, LevelX + 84, YTop
  488. EasyX.DrawSprite PointX, YTop, CharacterWidth, CharacterHeight, Character(P)
  489. EasyX.DrawSprite PointX + 16, YTop, CharacterWidth, CharacterHeight, Character(O)
  490. EasyX.DrawSprite PointX + 32, YTop, CharacterWidth, CharacterHeight, Character(I)
  491. EasyX.DrawSprite PointX + 48, YTop, CharacterWidth, CharacterHeight, Character(N)
  492. EasyX.DrawSprite PointX + 64, YTop, CharacterWidth, CharacterHeight, Character(T)
  493. DrawNumber TotalPoint, PointX + 90, YTop
  494. EasyX.DrawSprite BallsX, YTop, CharacterWidth, CharacterHeight, Character(L)
  495. EasyX.DrawSprite BallsX + 16, YTop, CharacterWidth, CharacterHeight, Character(I)
  496. EasyX.DrawSprite BallsX + 32, YTop, CharacterWidth, CharacterHeight, Character(V)
  497. EasyX.DrawSprite BallsX + 48, YTop, CharacterWidth, CharacterHeight, Character(E)
  498. EasyX.DrawSprite BallsX + 64, YTop, CharacterWidth, CharacterHeight, Character(S)
  499. DrawNumber BallsLeft, BallsX + 84, YTop
  500. End Sub
  501. Private Sub DrawNumber(Number As Long, X As Long, Y As Long)
  502. Dim I As Long
  503. Dim TempString As String
  504. Dim StringNumber As String
  505. StringNumber = CStr(Number)
  506. I = 1
  507. Do While Len(StringNumber) > 0
  508.     TempString = Mid(StringNumber, I, 1)
  509.     StringNumber = Right(StringNumber, Len(StringNumber) - 1)
  510.     Select Case TempString
  511.         Case "1"
  512.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(One)
  513.         Case "2"
  514.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(Two)
  515.         Case "3"
  516.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(Three)
  517.         Case "4"
  518.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(Four)
  519.         Case "5"
  520.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(Five)
  521.         Case "6"
  522.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(Six)
  523.         Case "7"
  524.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(Seven)
  525.         Case "8"
  526.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(Eight)
  527.         Case "9"
  528.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(Nine)
  529.         Case 0
  530.             EasyX.DrawSprite X, Y, CharacterWidth, CharacterHeight, Character(Zero)
  531.         
  532.     End Select
  533.     X = X + CharacterWidth
  534.         
  535. Exit Sub
  536. End Sub
  537. Private Sub RunReady()
  538. Ball.YPoint = ScreenHeight / 2 - BallHeight * 2
  539. Ball.XPoint = ScreenWidth / 2 - BallWidth / 2
  540. Ball.YDirection = -1
  541. Ball.XSpeed = CurrentLevel
  542. SetUpTimer.Enabled = True
  543. End Sub
  544.